$swatch-size: 20px;
$saturation-picker-height: 100px;
$slider-picker-height: 10px;
$colorpicker-width: 185px;

%colorpicker__component {
  position: relative;
  overflow: hidden;
  border: var(--border-default);
  border-radius: var(--border-radius-small);
  cursor: pointer;
}

.colorpicker {
  $size: 26px;
  display: flex;
  width: $size;
  height: $size;
  border-radius: 100%;
  border: var(--border-default);
  padding: var(--spacing-eighth-unit);

  &__outer {
    width: $colorpicker-width;
  }
  &__container {
    display: flex;
    align-items: center;
    line-height: 2;
    position: relative;
    width: $colorpicker-width;
  }
  &__selected-color {
    margin-left: var(--spacing-half-unit);
    color: var(--color-text-base);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-small);
    display: inline-block;
    vertical-align: middle;
    text-transform: uppercase;
  }
  &__swatch {
    border-radius: 50%;
    flex-grow: 1;
    width: 100%;
    height: 100%;
  }

  /* Saturation wrapper style */
  &__saturation {
    @extend %colorpicker__component;
    height: $saturation-picker-height;
  }
  &__custom-input {
    padding-top: var(--spacing-eighth-unit);
    input {
      border: var(--border-default) !important;
      box-shadow: none !important;
      background-color: var(--color-background-inputs);
      color: var(--color-text-dark);
    }
    input + span {
      color: var(--color-text) !important;
    }
  }

  /* Wrapper style for Hue and Alpha sliders and swatch */
  &__controls {
    .colorpicker__sliders {
      width: 100%;

      .colorpicker__slider {
        @extend %colorpicker__component;
        margin: auto 0;
        height: $slider-picker-height;
        margin: var(--spacing-eighth-unit) 0;
      }
    }

    .colorpicker__active {
      @extend %colorpicker__component;
      height: var(--spacing-base-unit);
      width: var(--spacing-base-unit);
      margin: var(--spacing-eighth-unit) 0 0 var(--spacing-half-unit);

      .colorpicker__active-swatch {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        border-radius: var(--border-radius-small);
        border: 1px solid #eee;
      }
    }
  }
}

.fold .fold {
  .colorpicker__container {
    width: calc(
      $colorpicker-width - var(--spacing-half-unit) - var(--spacing-half-unit)
    );
  }
}
